package com.njtoyo.taxi.admin.rest.controller.open;

import com.njtoyo.taxi.admin.aop.PassToken;
import com.njtoyo.taxi.admin.mapper.secondary.entity.DriverRegisterForm;
import com.njtoyo.taxi.admin.rest.wrapper.business.company.CompanyQueryWrapper;
import com.njtoyo.taxi.admin.service.open.DriverRegisterService;
import com.njtoyo.taxi.entity.backend.AdminUser;
import com.taxi.entity.common.RestResult;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;

import javax.validation.Valid;

@RestController
@RequestMapping("open/driver-register")
public class DriverRegisterController {

    @Autowired
    private DriverRegisterService driverRegisterService;

    @PostMapping("/add")
    @PassToken
    RestResult add(@Valid @RequestBody DriverRegisterForm form) {
        return driverRegisterService.add(form);
    }


    @GetMapping("/getCity")
    @PassToken
    public RestResult city(@RequestParam(value = "cityName", required = false) String cityName) {
        return driverRegisterService.getCityList(cityName);
    }

    @GetMapping("/getCompany")
    @PassToken
    RestResult getCompanyAll(@RequestParam(value = "companyName", required = false) String companyName) {
        return driverRegisterService.getCompany(companyName);
    }


    @GetMapping("/getCanton")
    @PassToken
    RestResult getCanton(@RequestParam(value = "cantonName", required = false) String cantonName) {
        return driverRegisterService.getCanton(cantonName);
    }
}